﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Autodesk.Revit.DB;
using YArchitech.LIB;

namespace YJKFamilyComparison
{
	internal class CategoryFilter : ICategoryFilter
	{
		private static void MakeCategoryWhiteList()
		{
			StreamReader streamReader = new StreamReader(Product.DataLocation + "\\模型对比族白名单.txt", Encoding.Default);
			string value;
			while ((value = streamReader.ReadLine()) != null)
			{
				BuiltInCategory item = (BuiltInCategory)Enum.Parse(typeof(BuiltInCategory), value);
                CategoryFilter.CategoryWhiteList.Add((int)item);
			}
		}

		internal CategoryFilter()
		{
			CategoryFilter.MakeCategoryWhiteList();
		}

		public bool IfCategoryUse(Category category)
		{
			return CategoryFilter.CategoryWhiteList.Contains(category.Id.IntegerValue);
		}

		private static List<int> CategoryWhiteList = new List<int>();
	}
}
